package Guess;

import java.util.Random;

/**
 * @Author admin
 * @Date 2019/3/15 8:08
 */
public class Guess {
    private  int random;
    private  int count;

    Guess(){

    }
    Guess (int random,int count){
        this.count=count;
        this.random=random;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
 /**
  * 产生随机数
  * */
    public int getRandom() {
        Random r=new Random();
        this.random=r.nextInt(10)+1;
        return random;
    }

    public void setRandom(int random) {
        this.random = random;
    }
    /**
     * 判断猜测的值g与随机数random是否相等，
     * 猜测次数累加
     *
     * */
    public String judge(int g){
        count++;
        if (g>random){
            return "bigger";
        }else if (g<random){
            return "smaller";
        }else {
            return "binGo";
        }
    }
}
